<?php

function smarty_function_loadjs($params, &$smarty) {
    $file = strtolower(trim($params["file"]));
    $version = strtolower(trim($params["version"]));
    switch ($file) {
        case "jquery":
            if (in_array($version, array("1.2.6", "1.26", "v1.2.6", "v1.26"))) {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/lib/jquery_9.js"></script>';
            } elseif (in_array($version, array("1.3.2", "1.32", "v1.3.2", "v1.32"))) {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/lib/jquery_10.js"></script>';
            } else {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/lib/jquery_10.js"></script>';
            }
            break;
        case "swfobject":
            if (in_array($version, array("1", "1.5", "v1", "v1.5"))) {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/fn/swfobject_19.js"></script>';
            } elseif (in_array($version, array("2", "2.0", "v2", "v2.0"))) {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/fn/swfobject2_5.js"></script>';
            } elseif (in_array($version, array("2.2",  "v2.2"))) {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/events/global/swfobject/swfobject.js"></script>';
            } else {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/fn/swfobject2_5.js"></script>';
            }
            break;
        case "swfobject1":
        case "swfobject1.5":
            $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/fn/swfobject_19.js"></script>';
            break;
        case "swfobject2":
            $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/fn/swfobject2_5.js"></script>';
            break;
        case "swfobject2.2":
            $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/events/global/swfobject/swfobject.js"></script>';
            break;
        case "g":
        case "tui":
            if ($version == "138") {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/_g_138.js"></script>';
            } elseif ($version == "150") {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/_g_150.js"></script>';
            } else {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/_g_138.js"></script>';
            }
            break;
        case "stat":
        case "stat_advert":
            $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/stat_advert.js"></script>';
            break;
        case "upload":
        case "publish":
        case "video-publish":
            if ($version == "0") {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/events/global/video-publish/mkt_upload_0.js"></script>';
            } else {
                $html = '<script type="text/javascript" language="javascript" src="http://js.tudouui.com/js/events/global/video-publish/mkt_upload_0.js"></script>';
            }
            break;
        default:
            $html = "";
    }
    return $html;
}

?>